home *** CD-ROM | disk | FTP | other *** search
- UNIT Print;
-
- {+----------------------------------------------------------------------------+
- | |
- | HodgePodge: An example Apple IIGS Desktop application |
- | |
- | Written in 65816 assembler and APW C by the Apple IIGS Tools Team |
- | Translated to TML Pascal by TML Systems, Inc. |
- | Modified by Ben Koning for "Programmer's Introduction to the Apple IIGS" |
- | |
- | Copyright (c) 1986-87 by Apple Computer, Inc. |
- | Copyright (c) 1987 by TML Systems, Inc. |
- | |
- | -------------------------------- |
- | |
- | Pascal UNIT "PRINT.PAS" : Window content printing routines |
- | |
- +----------------------------------------------------------------------------+}
-
-
-
- INTERFACE
-
- USES
- HPIntfData, {HodgePodge Apple IIGS Toolbox Interface Units}
- HPIntfProc,
- HPIntfPdos,
-
- Globals, {HodgePodge Code Units}
- Dialog,
- Font,
- Paint;
-
-
-
- procedure DoChooserItem; {Show standard chooser dialog to select options}
- procedure DoSetupItem; {Show standard page setup dialog to sel options}
- procedure DoPrintItem; {Print contents of current window to printer }
- procedure SetUpDefault; {Create and initialize THPrint record }
-
-
-
-
-
- IMPLEMENTATION
-
-
-
- VAR PrintHndl: PrRecHndl; {Private print record handle for Print Manager}
-
-
-
- procedure DrawTopWindow (theWindow: GrafPortPtr);
-
- {This private procedure determines what type of window theWindow is and
- calls the appropriate procedure to draw its contents to the current port
- which is now the printer port created in DoPrintItem.}
-
- var myDataHandle: WindDataH;
-
- begin {of DrawTopWindow}
- myDataHandle := WindDataH (GetWRefCon (theWindow));
- with myDataHandle^^ do
- if Flag = 0 then
- PaintIt (pict)
- else
- ShowFont (theFont,isMono);
- end; {of DrawTopWindow}
-
-
-
- procedure DoChooserItem;
-
- {Display the Chooser Dialog for the user to select which printer and
- printer connection to use.}
-
- var dummy: boolean;
-
- begin {of DoChooserItem}
- dummy := PrChooser;
- end; {of DoChooserItem}
-
-
-
- procedure DoPrintItem;
-
- {Print the contents of the front window to the selected printer.}
-
- var PrPort : GrafPortPtr;
- theWindow : GrafPortPtr;
-
- begin {of DoPrintItem}
- theWindow := FrontWindow;
- if theWindow <> nil then
- if PrJobDialog (PrintHndl) then begin
- WaitCursor;
- PrPort := PrOpenDoc (PrintHndl,nil);
- PrOpenPage (PrPort,nil);
- DrawTopWindow (theWindow);
- PrClosePage (PrPort);
- PrCloseDoc (PrPort);
- PrPicFile (PrintHndl,nil,nil);
- InitCursor;
- end;
- end; {of DoPrintItem}
-
-
-
- procedure DoSetupItem;
-
- {Display the Page Setup dialog for the user to choose the print mode,
- number of pages, etc. to print.}
-
- var dummy: boolean;
-
- begin {of DoSetupItem}
- dummy := PrStlDialog (PrintHndl);
- end; {of DoSetupItem}
-
-
-
- procedure SetUpDefault;
-
- {Create and initialize a THPrint record which is required for all
- printing operations.}
-
- begin {of SetUpDefault}
- PrintHndl := PrRecHndl (NewHandle (140,
- myMemoryID,
- attrNoCross + attrLocked,
- Ptr (0)));
- PrDefault (PrintHndl);
- end; {of SetUpDefault}
-
-
-
- END.
-